<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});
include 'user.php';
Route::get('/home', 'HomeController@index')->name('home');
Route::group(['prefix' => 'admin'], function () {
    Route::get('public/login', 'Admin\PublicController@loginshow')->name('admin.login');
    Route::post('public/login', 'Admin\PublicController@login')->name('admin.login');
    Route::get('public/logout', 'Admin\PublicController@logout')->name('admin.logout');
});
Route::group(['prefix' => 'admin', 'middleware' => 'auth.admin:admin'], function () {
    Route::get('index/index', 'Admin\IndexController@index')->name('admin.index');
    Route::get('index/welcome', 'Admin\IndexController@welcome')->name('admin.welcome');
    Route::get('question/subjectid-{id}/show', 'Admin\QuestionController@show')->name('admin.question.show');
    Route::get('question/sections-{id}/show', 'Admin\QuestionController@sectionsshow')->name('admin.sections.show');
    Route::get('config', 'Admin\ConfigController@index')->name('admin.config');
    Route::post('config/update', 'Admin\ConfigController@update')->name('admin.config.update');
    Route::resource('question', 'Admin\QuestionController', ['as' => 'admin', 'except' => 'show']);
    Route::resource('subject', 'Admin\SubjectController', ['as' => 'admin', 'except' => 'create']);
    Route::resource('manager', 'Admin\ManagerController', ['as' => 'admin', 'except' => 'show']);
    Route::get('sections/subjectid-{id}/index', 'Admin\SectionsController@index')->name('admin.sections.index');
    Route::get('sections/subjectid-{id}/create', 'Admin\SectionsController@create')->name('admin.sections.create');
    Route::post('sections', 'Admin\SectionsController@store')->name('admin.sections.store');
    Route::get('sections/{sections}', 'Admin\SectionsController@edit')->name('admin.sections.edit');
    Route::put('sections/{sections}', 'Admin\SectionsController@update')->name('admin.sections.update');
    Route::delete('sections/{sections}', 'Admin\SectionsController@destroy')->name('admin.sections.destroy');
});
